import type { StorybookViteConfig } from "@storybook/builder-vite";
const { mergeConfig } = require("vite");

const config: StorybookViteConfig = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
  ],
  framework: "@storybook/react",
  core: {
    builder: "@storybook/builder-vite",
  },
  features: {
    storyStoreV7: true,
  },
  async viteFinal(config) {
    return mergeConfig(config, {
      css: (await import("../vite.config")).default.css,
      resolve: (await import("../vite.config")).default.resolve,
    });
  },
};

export default config;
